﻿package mortal.game.view.mainUI.roleAvatar
{
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.manager.*;
    import flash.display.*;
    import mortal.game.view.common.*;

    public class BuffItem extends ToolTipSprite
    {
        private var _buffData:BuffData;
        private var _buffIcon:GImageBitmap;
        private var _bg:GBitmap;
        private var _padingTop:int = 2;
        private var _padingLeft:int = 2;

        public function BuffItem()
        {
            this.setSize(15, 15);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = true;
            this.mouseChildren = false;
            this._bg = UIFactory.gBitmap("", 0, 0, this);
            this._buffIcon = UIFactory.gImageBitmap("", 0, 0, this, this.resetPos);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._buffIcon.dispose(param1);
            this._buffIcon = null;
            this._bg.dispose(param1);
            this._bg = null;
            this._padingTop = 2;
            this._padingLeft = 2;
            this._buffData.iconGroupList = null;
            this._buffData = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function get buffData() : BuffData
        {
            return this._buffData;
        }// end function

        public function set buffData(param1:BuffData) : void
        {
            this._buffData = param1;
            this._buffIcon.bitmapData = null;
            if (param1)
            {
                this._buffIcon.imgUrl = param1.getIconPath();
            }
            else
            {
                this._buffIcon.imgUrl = null;
            }
            judgeToolTip();
            return;
        }// end function

        override public function get toolTipData()
        {
            return this._buffData;
        }// end function

        public function set bg(param1) : void
        {
            if (param1 is String)
            {
                this._bg.bitmapData = GlobalClass.getBitmapData(param1);
            }
            else if (param1 is BitmapData)
            {
                this._bg.bitmapData = param1;
            }
            return;
        }// end function

        private function resetPos() : void
        {
            var _loc_1:int = 13;
            this._buffIcon.height = 13;
            this._buffIcon.width = _loc_1;
            this._buffIcon.x = this._padingLeft;
            this._buffIcon.y = this._padingTop;
            return;
        }// end function

    }
}
